import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;


public class Driver {

	public static void main(String[] args) {
		Scanner s = new Scanner (System.in);


		System.out.println("how many cats would you like to fight?");

		int loopCount = s.nextInt();

		//Cat[]CatArray= new Cat[loopCount] ;
		ArrayList<Cat> CatArray= new ArrayList<Cat>();

		//	Cat catone= new Cat( "bob","green",4);

		String[]names= {"bob", "tim", "geogre","greg","jill", "zack","flower","spot"};
		String[]colors= {"Black", "Red", "White","Brown","Gray", "Blue","Ginger","Pink"};

		int namecount =0;
		int count= 1;
		Random a= new Random();
		while (loopCount>0){

			//			System.out.println("what is the name of Cat number"+ count);
			//			String name= s.next();
			//			System.out.println("what is the color of Cat number"+ count);
			//			String color= s.next();
			//			System.out.println("what is the age of Cat number"+ count);
			//			int age= s.nextInt();

			Cat y= new Cat( names[a.nextInt(7)], colors[a.nextInt(7)]);
			Cat c= new Cat( names[a.nextInt(7)], colors[a.nextInt(7)],a.nextInt(20));
			Cat d= new Cat(y);
			CatArray.add(c);
			count++;
			loopCount--;

		}


		//		for (int index=0;index<CatArray.size();index++){
		//
		//			System.out.println(CatArray.get(index).toString());
		//			//CatArray[index].die();
		//
		//		}
		int fightCount=0;
		while (CatArray.size()>1){
			//removeDeadCats(CatArray);
			int IndexOfCatOne =a.nextInt(CatArray.size());
			int IndexOfCatTwo =a.nextInt(CatArray.size());
			
			if (IndexOfCatOne==IndexOfCatTwo){
				continue;
			}

			CatArray.get(IndexOfCatOne).fight(CatArray.get(IndexOfCatTwo));
			fightCount++;

			for (int index=0;index<CatArray.size();index++){

				if (!CatArray.get(index).isAvile()){
					CatArray.remove(index);
				}

			}

			
		}
System.out.println(CatArray.get(0).toString());
System.out.println("there were " + fightCount + "number of fights");
	}
	public static void removeDeadCats(ArrayList<Cat> list) {

		for (int index=0;index<list.size();index++){

			if (!list.get(index).isAvile()){
				list.remove(index);
			}

		}

	}
}
